﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogisticsBLL;
using System.Data.SqlClient;
using Model;

namespace WebLosgic.CapacityTruck
{
    public partial class CarrierSingle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rptBind();
            }
        }

        public void rptBind()
        {
            CarrierBLL cb = new CarrierBLL();
            Carriers cs = new Carriers();
            cs.CarriesID = TxtNumber.Text;
            cs.LeaverDate = TxtChenDate.Text;
            cs.LeaverEndDate = Txtchengdata.Text;
            cs.SendLinkman = TxtShipper.Text;
            cs.ReceiveLinkman = Txtpeople.Text;
            cs.UserName = TxtBusiness.Text;
            cs.ReceiveDate = TxtReceDate.Text;
            cs.ReceiveEndDate = TextReceData2.Text;
            cs.pageIndex = AspNetPagerTool.CurrentPageIndex;
            cs.pageSize = AspNetPagerTool.PageSize;
            int Rescout = 0;
            RptBindDrive.DataSource = cb.carsoldSel(cs, out Rescout);
            AspNetPagerTool.RecordCount = Rescout;
            RptBindDrive.DataBind();
        }

        protected void Lbtn_Click(object sender, EventArgs e)
        {
            int carrid = Convert.ToInt32(((LinkButton)sender).CommandArgument);
            Response.Redirect("../Carress/Carriesdetails.aspx?ID="+carrid);
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            CarrierBLL cb = new CarrierBLL();
            Carriers cs = new Carriers();
            cs.CarriesID = TxtNumber.Text;
            cs.LeaverDate = TxtChenDate.Text;
            cs.LeaverEndDate = Txtchengdata.Text;
            cs.SendLinkman =TxtShipper.Text;
            cs.ReceiveLinkman = Txtpeople.Text;
            cs.UserName = TxtBusiness.Text;
            cs.ReceiveDate = TxtReceDate.Text;
            cs.ReceiveEndDate = TextReceData2.Text;
            cs.pageIndex = AspNetPagerTool.CurrentPageIndex;
            cs.pageSize = AspNetPagerTool.PageSize;
            int Rescout = 0;
            RptBindDrive.DataSource = cb.carsoldSel(cs,out Rescout);
            AspNetPagerTool.RecordCount = Rescout;
            RptBindDrive.DataBind();
        }

        protected void AspNetPagerTool_PageChanged(object sender, EventArgs e)
        {
            rptBind();
        }
    }
}